'use strict';

(function (app) {


//创建控制器
    app.register.controller('monitorSchsessionCtrl', ['$scope', '$http', '$filter', '$rootScope', function ($scope, $http, $filter, $rootScope) {
        $rootScope.mask=true;
        var count = 10;
        $scope.count = count;
        $scope.clientId = "";
        $scope.startdate = moment().add(-1,"h").startOf("m");
        $scope.enddate = moment();
        $scope.online=""
        $scope.pageChanged = function () {
            $rootScope.loading_text = "努力加载中..."
            $http.post("./data/schsession", {
                    curPage: $scope.currentPage,
                    count: count,
                    clientid: $scope.clientId,
                    online:$scope.online,
                    startdate: $scope.startdate.format("YYYY-MM-DD HH:mm:ss"),
                    enddate: $scope.enddate.format("YYYY-MM-DD HH:mm:ss")

                })
                .success(function (response) {
                    $scope.data = response.Datas;
                    $scope.currentPage = response.CurPage
                    $scope.totalPage = response.TotalPage
                });
            $log.log('Page changed to: ' + $scope.currentPage);
        };
        $scope.sch = function () {
            $rootScope.loading_text = "努力加载中...";
            console.log($scope.startdate)
            $http.post("./data/schsession", {
                    curPage: 1,
                    count: count,
                    clientid: $scope.clientId,
                    online:$scope.online,
                    startdate: $scope.startdate.format("YYYY-MM-DD HH:mm:ss"),
                    enddate: $scope.enddate.format("YYYY-MM-DD HH:mm:ss")


                })
                .success(function (response) {
                    $scope.data = response.Datas;
                    $scope.currentPage = response.CurPage
                    $scope.totalPage = response.TotalPage
                });
        };
        $scope.maxSize = 10;
        $scope.totalPage = 1;
        $scope.currentPage = 1;


    }])
})(app);